import org.jsoup.Jsoup;
import org.jsoup.nodes.Document;

/**
 * 使用Chrome的 LiveHttpHeader 插件抓取到HttpRequest Header的 Cookie，然后贴到cookie.txt 中即可。
 */
public class Poster {

	public static String cookie = "Cookie: ASPSESSIONIDSARRBDCD=DPPDNPLBGGDBBEPCGOJOLNJE; bdshare_firstime=1395371285361; CNZZDATA1442173=cnzz_eid%3D853434924-1395371282-%26ntime%3D1395371282%26cnzz_a%3D1%26ltime%3D1395371284288; Hm_lvt_7908800c25ce2512d9ef05a0b0199842=1395371285; Hm_lpvt_7908800c25ce2512d9ef05a0b0199842=1395371302; XCHRCMS=self%5Flink=person%5Finfo%2Easp&LoginIP=60%2E55%2E9%2E42&LoginTimes=2014%2D3%2D10+0%3A44%3A29&self%5Fpath=Geren&user%5Flogin=misoag&user%5Fpass=8085D62C120D924EF4335AB743575641&user%5Ftype=pmember";
	
	public static void main(String[] args) {
		getHTML("http://www.fxrcw.net/geren/person_info.asp", cookie);
	}

	public static void getHTML(String url, String cookie) {
		try {
			Document doc = Jsoup
					.connect(url)
					.userAgent("Mozilla/5.0 (compatible; Baiduspider/2.0; +http://www.baidu.com/search/spider.html)")
					//.userAgent("Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/33.0.1750.152 Safari/537.36")
					.header("Accept-Language", "zh-CN,zh;q=0.8,en;q=0.6,zh-TW;q=0.4")
					.header("Accept-Encoding", "gzip,deflate,sdch")
					.header("Accept", "*/*")
					.header("Cookie", cookie.split(":")[1].trim())
					.timeout(1000)

					.get();
			String html = doc.toString();
			System.out.println(html);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
